public class Test {

    public static void main(String[] args) {
        for (int i = 0; i < 99999; i++) {
         //1.求当前数字i是一个几位数
         int count = 0;
         //i= 123
            int tmp =i;
            while (tmp!=0) {
                count++;
                tmp /= 10;
            }
            //tmp = 0 count= 3
            tmp = i;//123
            int sum = 0;
            while (tmp!=0) {
                sum += Math.pow(tmp % 10,count);
                tmp /= 10;
            }
            if(sum == i){
                System.out.println(count+ " 位的自幂数为："+i);
            }
        }
    }
    public static void main23(String[] args) {
        int n =7;
        int i =2;
        for (; i <= Math.sqrt(n); i++) {
            if (n % i == 0) {
                System.out.println("不是素数！");
                break;
            }
        }
        if(i > Math.sqrt(n)){
            System.out.println("是素数！");
        }
    }
    public static void main22(String[] args) {
        int n =9;
        int i =2;
        for (; i <= n/2; i++) {
            if (n % i == 0) {
                System.out.println("不是素数！");
                break;
            }
        }
        if(i > n/2){
            System.out.println("是素数！");
        }
    }
    public static void main21(String[] args) {
        int n =9;
        int i =2;
        for (; i <= n-1; i++) {
            if (n % i == 0) {
                System.out.println("不是素数！");
                break;
            }/*else{
                System.out.println("是素数！");
            }*/
        }
        if(i > n-1){
            System.out.println("是素数！");
        }
    }
    public static void main20(String[] args) {
        int num=1;
        do{
            System.out.println(num);
            num++;
        }while(num<=0);
    }
    public static void main19(String[] args) {
        /*for (int i = 1;    ; i++) {
            System.out.println("傻了吧！！！");
        }*/
        while(true) {

        }
    }
    public static void main18(String[] args) {
        int sum =0;
        for (int j = 1; j <5 ; j++) {
            int ret =1;
            for (int i = 1; i < j; i++) {
                ret *=i;
            }
            sum += ret;
        }
        System.out.println(sum);
    }
    public static void main17(String[] args) {
        int ret =1;
        for (int i = 1; i < 5; i++) {
            ret *= i;
        }
        System.out.println(ret);
    }

    public static void main16(String[] args) {
        int sum=0;
        for (int i = 1; i < 5; i++) {
            sum+=i;
        }
        System.out.println(sum);//sum.sout
    }
//找出1~100之间，既能被3整除，也能被4整除的所有数字
    public static void main15(String[] args) {
        int i =1;
        while(i<=100) {
            if(i % 12 != 0){
                i++;
                continue;
            }
            System.out.println(i+" ");
            i++;
        }
    }
    public static void main14(String[] args) {
        int i =100;
        while(i<=200) {
            if(i % 3 != 0){
                i++;
                continue;
            }
            System.out.println(i+" ");
            i++;
        }
    }
    public static void main13(String[] args) {
        int i =100;
        while(i<=200) {
            if(i % 3 == 0){
                System.out.println(i);
                i++;
                continue;
            }
            i++;
        }
    }
    public static void main12(String[] args) {
        int i =100;
        while(i<=200) {
            if(i % 3 == 0){
                System.out.println(i);
                break;
            }
           i++;
        }
    }
    public static void main11(String[] args) {
        int a =1;
        while(a<=10) {
            if(a == 3){
                a++;
                continue;
            }
            System.out.println(a + " ");
            a++;
        }
    }
    public static void main10(String[] args) {
        int a=1;
//        while(a<10){
//            System.out.println("haha");
//            a++;
//        }
        //要加花括号
        while (a<10) {
            while (a < 5) {
                System.out.println("fafa");
                a++;
            }
        }
    }
    public static void main9(String[] args) {
        int j =1;
        int sum =0;
        while (j <= 6) {//循环的判断条件
            int i =1;
            int ret =1;
            while (i <= j) {
                ret *= i;
                i++;
            }
            sum +=ret;
            j++;
        }
        System.out.println(sum);
    }
    public static void main8(String[] args) {
       int i=1;//循环的初始条件
       int ret =1;
        while (i <= 5) {//循环的判断条件
            ret *= i;
            i++;//循环的改变条件
        }
        System.out.println(ret);
    }
//1到100之间偶数的和
    public static void main7(String[] args) {
        int i =1;//循环的初始条件
        int sum=0;
        while (i <= 100) {//循环的判断条件
            sum += i;
            i += 2;//循环的改变条件
        }
        System.out.println(sum);
    }
    public static void main6(String[] args) {
        int i =1;
        while (i<= 10){
            System.out.println(i+" ");
            i++;
        }
//        {
//            System.out.println("Fdsafdsafdsafa");
//        }
    }
    public static void main5(String[] args) {
        //double a =6.0f;
        //boolean = true;
        int a =1;
        String str ="abcd";
        switch (str){
            case "abcd":
                System.out.println("1");
                break;//中断
           /* case 2:
                System.out.println("2");
                break;
            case 3:
                System.out.println("3");
                break;*/
            default:
                System.out.println("匹配失败");
                break;
        }
    }
    public static void main4(String[] args) {
        int a =20;
        if (a == 10) {
            System.out.println("a == 10");
        }
    }

    public static void main3(String[] args) {
        int year = 2005;
        if(year % 100!= 0){
            if(year % 4 ==0){
                System.out.println(year+" 是闰年");
            }else {
                System.out.println(year+" 不是闰年");
            }
        }else {
            if(year % 4 ==0) {
                System.out.println(year+" 是闰年");
            }else {
                System.out.println(year+" 不是闰年");
            }
        }
    }

    public static void main2(String[] args) {
        int a=14;
        if(a%2==0){
            System.out.println(a + " 是偶数");
        }else {
            System.out.println(a + " 是奇数");
        }
    }

    public static void main1(String[] args) {
        int a =10;
        if(a>10) {
            System.out.println("a>10");
        }else if(a<10){
            System.out.println("a<10");
        }else {
            System.out.println("a==10");
        }
    }
}
